{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from malay_stopwords import stopwords, stopwords_1, _list_laugh\n",
    "from malay_normalization import rules_normalizer, sounds\n",
    "from malay_lexicon_polarity import neg_Words,pos_Words,translated_pos_words,translated_neg_words\n",
    "import sys\n",
    "import warnings\n",
    "\n",
    "if not sys.warnoptions:\n",
    "    warnings.simplefilter('ignore')\n",
    "\n",
    "import numpy as np\n",
    "import json\n",
    "import re\n",
    "from unidecode import unidecode\n",
    "import itertools"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "#analyzing method\n",
    "pos ='1'\n",
    "neg ='-1'\n",
    "neu ='0'\n",
    "pos_senti = set(list(pos_Words))\n",
    "neg_senti = set(list(neg_Words))\n",
    "def sentiment(words):\n",
    "    pslen= len(pos_senti.intersection(words))\n",
    "    nglen= len(neg_senti.intersection(words))\n",
    "    \n",
    "    if pslen > nglen:\n",
    "        return pos\n",
    "    elif pslen < nglen:\n",
    "        return neg\n",
    "    else:\n",
    "        return neu"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "#analyzing method\n",
    "from collections import Counter\n",
    "\n",
    "def count_senti(sentences):\n",
    "    sents = Counter()\n",
    "    words = Counter()\n",
    "    \n",
    "    for sentence in sentences:\n",
    "        senti = sentiment(sentence)\n",
    "        sents[senti] += 1\n",
    "        words[senti]+= len(sentence)\n",
    "    return sents,words"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "#analyzing overall sentiment\n",
    "import nltk\n",
    "def parse_senti(text):\n",
    "    \n",
    "    sentences = [\n",
    "        [word.lower() for word in nltk.word_tokenize(sentence)]\n",
    "        for sentence in nltk.sent_tokenize(text)\n",
    "    ]\n",
    "    \n",
    "    sents, words = count_senti(sentences)\n",
    "    total = sum(words.values())\n",
    "    \n",
    "    for sentiment, count in words.items():\n",
    "        pcent = (count / total) * 100\n",
    "        nsents = sents[sentiment]\n",
    "        \n",
    "        return(\n",
    "            sentiment\n",
    "        )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "#pre-processing normalization\n",
    "def _dict_replace(wordlist, _dict):\n",
    "        return [_dict.get(w, w) for w in wordlist]\n",
    "\n",
    "def cleaning2(e_texts,rules):\n",
    "    text1 = e_texts.split()   \n",
    "    text1 = _dict_replace(text1, rules)\n",
    "    text1 = ' '.join(text1)\n",
    "    return text1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "#preprocessing removing stopwords & symbol\n",
    "STOPWORDS = set(stopwords + stopwords_1 + _list_laugh)\n",
    "def clean_tweet(tweet):\n",
    "    comments = ' '.join(re.sub(\"(@[A-Za-z0-9]+)|([^0-9A-Za-z \\t])|(\\w+:\\/\\/\\S+)|[^a-zA-Z#]\",\" \",str(tweet)).split())\n",
    "    comments = comments.lower().split()\n",
    "    comments = ' '.join([word for word in comments if word not in STOPWORDS])\n",
    "    return comments"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "#final improvement\n",
    "def negate(self,text):\n",
    "\n",
    "    negation = False\n",
    "    delims = \"?.,!:;\"\n",
    "    result = []\n",
    "    words = text.split()\n",
    "    \n",
    "\n",
    "    for word in words:\n",
    "        stripped = word.strip(delims).lower()\n",
    "        negated = \"tak_\" + stripped if negation else stripped\n",
    "        result.append(negated)\n",
    "        negation = False\n",
    "\n",
    "        if any(neg in word for neg in [\"tak\",\"bukan\", \"Tak\",\"tidak\",\"kurang\"]):\n",
    "            negation = not negation\n",
    "\n",
    "    final= ' '.join(result)\n",
    "\n",
    "    return final"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "df= pd.read_csv('restaurant review comments.csv',encoding = \"ISO-8859-1\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tweet</th>\n",
       "      <th>senti</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>turn off betul kedai makan bancuh air tak seda...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Mende tah aku makan tadi. Tak sedap. *sebab bo...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>@nikasyrvf Mestii, sini kedai makan bukan seda...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Tapi milo dekat fast food restaurant tak sedap...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Semua makanan bau tengik. Loya tekak dibuatnya...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                               tweet  senti\n",
       "0  turn off betul kedai makan bancuh air tak seda...     -1\n",
       "1  Mende tah aku makan tadi. Tak sedap. *sebab bo...     -1\n",
       "2  @nikasyrvf Mestii, sini kedai makan bukan seda...     -1\n",
       "3  Tapi milo dekat fast food restaurant tak sedap...     -1\n",
       "4  Semua makanan bau tengik. Loya tekak dibuatnya...     -1"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tweet</th>\n",
       "      <th>senti</th>\n",
       "      <th>tweets</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>turn off betul kedai makan bancuh air tak seda...</td>\n",
       "      <td>-1</td>\n",
       "      <td>turn off makan bancuh air tak sedap ni tak pay...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Mende tah aku makan tadi. Tak sedap. *sebab bo...</td>\n",
       "      <td>-1</td>\n",
       "      <td>mende tah makan tak sedap claim makan mengarut</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>@nikasyrvf Mestii, sini kedai makan bukan seda...</td>\n",
       "      <td>-1</td>\n",
       "      <td>mestii makan bukan sedap haha</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Tapi milo dekat fast food restaurant tak sedap...</td>\n",
       "      <td>-1</td>\n",
       "      <td>milo fast food restaurant tak sedap</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Semua makanan bau tengik. Loya tekak dibuatnya...</td>\n",
       "      <td>-1</td>\n",
       "      <td>bau tengik loya tekak ape teruk peel demam pre...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                               tweet  senti  \\\n",
       "0  turn off betul kedai makan bancuh air tak seda...     -1   \n",
       "1  Mende tah aku makan tadi. Tak sedap. *sebab bo...     -1   \n",
       "2  @nikasyrvf Mestii, sini kedai makan bukan seda...     -1   \n",
       "3  Tapi milo dekat fast food restaurant tak sedap...     -1   \n",
       "4  Semua makanan bau tengik. Loya tekak dibuatnya...     -1   \n",
       "\n",
       "                                              tweets  \n",
       "0  turn off makan bancuh air tak sedap ni tak pay...  \n",
       "1     mende tah makan tak sedap claim makan mengarut  \n",
       "2                      mestii makan bukan sedap haha  \n",
       "3                milo fast food restaurant tak sedap  \n",
       "4  bau tengik loya tekak ape teruk peel demam pre...  "
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "df['tweets']=np.array([clean_tweet(text) for text in df.tweet])\n",
    "df.head(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tweet</th>\n",
       "      <th>senti</th>\n",
       "      <th>tweets</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>turn off betul kedai makan bancuh air tak seda...</td>\n",
       "      <td>-1</td>\n",
       "      <td>turn off makan bancuh air tak sedap ni tak pay...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Mende tah aku makan tadi. Tak sedap. *sebab bo...</td>\n",
       "      <td>-1</td>\n",
       "      <td>mende tah makan tak sedap claim makan mengarut</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>@nikasyrvf Mestii, sini kedai makan bukan seda...</td>\n",
       "      <td>-1</td>\n",
       "      <td>mestii makan bukan sedap haha</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Tapi milo dekat fast food restaurant tak sedap...</td>\n",
       "      <td>-1</td>\n",
       "      <td>milo fast food restaurant tak sedap</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Semua makanan bau tengik. Loya tekak dibuatnya...</td>\n",
       "      <td>-1</td>\n",
       "      <td>bau tengik loya tekak ape teruk peel demam pre...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                               tweet  senti  \\\n",
       "0  turn off betul kedai makan bancuh air tak seda...     -1   \n",
       "1  Mende tah aku makan tadi. Tak sedap. *sebab bo...     -1   \n",
       "2  @nikasyrvf Mestii, sini kedai makan bukan seda...     -1   \n",
       "3  Tapi milo dekat fast food restaurant tak sedap...     -1   \n",
       "4  Semua makanan bau tengik. Loya tekak dibuatnya...     -1   \n",
       "\n",
       "                                              tweets  \n",
       "0  turn off makan bancuh air tak sedap ni tak pay...  \n",
       "1     mende tah makan tak sedap claim makan mengarut  \n",
       "2                      mestii makan bukan sedap haha  \n",
       "3                milo fast food restaurant tak sedap  \n",
       "4  bau tengik loya tekak ape teruk peel demam pre...  "
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "df['tweets']=np.array([cleaning2(text,sounds) for text in df.tweets])\n",
    "df.head(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tweet</th>\n",
       "      <th>senti</th>\n",
       "      <th>tweets</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>turn off betul kedai makan bancuh air tak seda...</td>\n",
       "      <td>-1</td>\n",
       "      <td>turn off makan bancuh air tak sedap ini tak pa...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Mende tah aku makan tadi. Tak sedap. *sebab bo...</td>\n",
       "      <td>-1</td>\n",
       "      <td>mende entah makan tak sedap claim makan mengarut</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>@nikasyrvf Mestii, sini kedai makan bukan seda...</td>\n",
       "      <td>-1</td>\n",
       "      <td>mestii makan bukan sedap haha</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Tapi milo dekat fast food restaurant tak sedap...</td>\n",
       "      <td>-1</td>\n",
       "      <td>milo fast food restaurant tak sedap</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Semua makanan bau tengik. Loya tekak dibuatnya...</td>\n",
       "      <td>-1</td>\n",
       "      <td>bau tengik loya tekak apa teruk peel demam pre...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                               tweet  senti  \\\n",
       "0  turn off betul kedai makan bancuh air tak seda...     -1   \n",
       "1  Mende tah aku makan tadi. Tak sedap. *sebab bo...     -1   \n",
       "2  @nikasyrvf Mestii, sini kedai makan bukan seda...     -1   \n",
       "3  Tapi milo dekat fast food restaurant tak sedap...     -1   \n",
       "4  Semua makanan bau tengik. Loya tekak dibuatnya...     -1   \n",
       "\n",
       "                                              tweets  \n",
       "0  turn off makan bancuh air tak sedap ini tak pa...  \n",
       "1   mende entah makan tak sedap claim makan mengarut  \n",
       "2                      mestii makan bukan sedap haha  \n",
       "3                milo fast food restaurant tak sedap  \n",
       "4  bau tengik loya tekak apa teruk peel demam pre...  "
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['tweets']=np.array([cleaning2(text,rules_normalizer) for text in df.tweets])\n",
    "df.head(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tweet</th>\n",
       "      <th>senti</th>\n",
       "      <th>tweets</th>\n",
       "      <th>without_valenceshifter</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>turn off betul kedai makan bancuh air tak seda...</td>\n",
       "      <td>-1</td>\n",
       "      <td>turn off makan bancuh air tak sedap ini tak pa...</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Mende tah aku makan tadi. Tak sedap. *sebab bo...</td>\n",
       "      <td>-1</td>\n",
       "      <td>mende entah makan tak sedap claim makan mengarut</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>@nikasyrvf Mestii, sini kedai makan bukan seda...</td>\n",
       "      <td>-1</td>\n",
       "      <td>mestii makan bukan sedap haha</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Tapi milo dekat fast food restaurant tak sedap...</td>\n",
       "      <td>-1</td>\n",
       "      <td>milo fast food restaurant tak sedap</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Semua makanan bau tengik. Loya tekak dibuatnya...</td>\n",
       "      <td>-1</td>\n",
       "      <td>bau tengik loya tekak apa teruk peel demam pre...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Aku rasa aku kena mula jaga pemakanan. Gastrik...</td>\n",
       "      <td>-1</td>\n",
       "      <td>kena jaga pemakanan gastrik ini teruk makan ke...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Apa dia letak sia kat makanan aku. Balik sakit...</td>\n",
       "      <td>-1</td>\n",
       "      <td>letak sia sakit kepala teruk ini</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>@KuaiMuhamad Tak jgk.. Lama gak x kena food po...</td>\n",
       "      <td>-1</td>\n",
       "      <td>tak juga gak tidak kena food poisoning just my...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>LoL jual makanan tak sedap pastu mahal lak tu ...</td>\n",
       "      <td>-1</td>\n",
       "      <td>jual tak sedap mahal pula itu haiss</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Makanan dia tak berapa sedap la for me. Dekat ...</td>\n",
       "      <td>-1</td>\n",
       "      <td>tak sedap lah untuk me surau disediakan</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Makanan mahal2 ni aku memamg cop tak pernah se...</td>\n",
       "      <td>-1</td>\n",
       "      <td>mahal ini memamg cop tak sedap tak tahu mahal</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Lepas settle urusan kat sekolah, kitorang perg...</td>\n",
       "      <td>-1</td>\n",
       "      <td>settle urusan sekolah kitorang pergi lunch res...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>@JohanRayyan Hahahaha! Adeihhh... Rasa mahal g...</td>\n",
       "      <td>-1</td>\n",
       "      <td>hahahaha adeihhh mahal gila milo fast food res...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Tropicana Avenue tu ada la restaurant yang mcm...</td>\n",
       "      <td>-1</td>\n",
       "      <td>tropicana avenue itu lah restaurant mahal siki...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>\"kamu tahu tak kerusi di restaurant fast food ...</td>\n",
       "      <td>-1</td>\n",
       "      <td>tak kerusi restaurant fast food duduk tak sele...</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Menyesal siak mkn makanan pedas skrg dh sakit ...</td>\n",
       "      <td>-1</td>\n",
       "      <td>menyesal siak mkn pedas skrg dah sakit perut a...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>Makan-makanan pedas bikin sakit perut. Dan mel...</td>\n",
       "      <td>-1</td>\n",
       "      <td>makan pedas bikin sakit perut melelahkan</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>b'Kyochon ini enak banget tapi juga mahal bang...</td>\n",
       "      <td>-1</td>\n",
       "      <td>b kyochon enak banget mahal banget wqwqwqwq</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>b'@AsipMutakin Weh kfry tk sedap taknak pegi l...</td>\n",
       "      <td>-1</td>\n",
       "      <td>b weh kfry tak sedap tak nak pergi kyochon tak...</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>b'@luqmangg @nraleeya Tapi pedas kfry campur c...</td>\n",
       "      <td>-1</td>\n",
       "      <td>b pedas kfry campur cheese muak kyochon just n...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                tweet  senti  \\\n",
       "0   turn off betul kedai makan bancuh air tak seda...     -1   \n",
       "1   Mende tah aku makan tadi. Tak sedap. *sebab bo...     -1   \n",
       "2   @nikasyrvf Mestii, sini kedai makan bukan seda...     -1   \n",
       "3   Tapi milo dekat fast food restaurant tak sedap...     -1   \n",
       "4   Semua makanan bau tengik. Loya tekak dibuatnya...     -1   \n",
       "5   Aku rasa aku kena mula jaga pemakanan. Gastrik...     -1   \n",
       "6   Apa dia letak sia kat makanan aku. Balik sakit...     -1   \n",
       "7   @KuaiMuhamad Tak jgk.. Lama gak x kena food po...     -1   \n",
       "8   LoL jual makanan tak sedap pastu mahal lak tu ...     -1   \n",
       "9   Makanan dia tak berapa sedap la for me. Dekat ...     -1   \n",
       "10  Makanan mahal2 ni aku memamg cop tak pernah se...     -1   \n",
       "11  Lepas settle urusan kat sekolah, kitorang perg...     -1   \n",
       "12  @JohanRayyan Hahahaha! Adeihhh... Rasa mahal g...     -1   \n",
       "13  Tropicana Avenue tu ada la restaurant yang mcm...     -1   \n",
       "14  \"kamu tahu tak kerusi di restaurant fast food ...     -1   \n",
       "15  Menyesal siak mkn makanan pedas skrg dh sakit ...     -1   \n",
       "16  Makan-makanan pedas bikin sakit perut. Dan mel...     -1   \n",
       "17  b'Kyochon ini enak banget tapi juga mahal bang...     -1   \n",
       "18  b'@AsipMutakin Weh kfry tk sedap taknak pegi l...     -1   \n",
       "19  b'@luqmangg @nraleeya Tapi pedas kfry campur c...     -1   \n",
       "\n",
       "                                               tweets without_valenceshifter  \n",
       "0   turn off makan bancuh air tak sedap ini tak pa...                      1  \n",
       "1    mende entah makan tak sedap claim makan mengarut                      0  \n",
       "2                       mestii makan bukan sedap haha                      1  \n",
       "3                 milo fast food restaurant tak sedap                      1  \n",
       "4   bau tengik loya tekak apa teruk peel demam pre...                     -1  \n",
       "5   kena jaga pemakanan gastrik ini teruk makan ke...                     -1  \n",
       "6                    letak sia sakit kepala teruk ini                     -1  \n",
       "7   tak juga gak tidak kena food poisoning just my...                     -1  \n",
       "8                 jual tak sedap mahal pula itu haiss                      0  \n",
       "9             tak sedap lah untuk me surau disediakan                      1  \n",
       "10      mahal ini memamg cop tak sedap tak tahu mahal                      0  \n",
       "11  settle urusan sekolah kitorang pergi lunch res...                     -1  \n",
       "12  hahahaha adeihhh mahal gila milo fast food res...                     -1  \n",
       "13  tropicana avenue itu lah restaurant mahal siki...                     -1  \n",
       "14  tak kerusi restaurant fast food duduk tak sele...                      0  \n",
       "15  menyesal siak mkn pedas skrg dah sakit perut a...                     -1  \n",
       "16           makan pedas bikin sakit perut melelahkan                     -1  \n",
       "17        b kyochon enak banget mahal banget wqwqwqwq                      0  \n",
       "18  b weh kfry tak sedap tak nak pergi kyochon tak...                      1  \n",
       "19  b pedas kfry campur cheese muak kyochon just n...                     -1  "
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['without_valenceshifter'] = df['tweets'].apply(parse_senti)\n",
    "df.head(20)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tweet</th>\n",
       "      <th>senti</th>\n",
       "      <th>tweets</th>\n",
       "      <th>without_valenceshifter</th>\n",
       "      <th>negation</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>turn off betul kedai makan bancuh air tak seda...</td>\n",
       "      <td>-1</td>\n",
       "      <td>turn off makan bancuh air tak sedap ini tak pa...</td>\n",
       "      <td>1</td>\n",
       "      <td>turn off makan bancuh air tak tak_sedap ini ta...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Mende tah aku makan tadi. Tak sedap. *sebab bo...</td>\n",
       "      <td>-1</td>\n",
       "      <td>mende entah makan tak sedap claim makan mengarut</td>\n",
       "      <td>0</td>\n",
       "      <td>mende entah makan tak tak_sedap claim makan me...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>@nikasyrvf Mestii, sini kedai makan bukan seda...</td>\n",
       "      <td>-1</td>\n",
       "      <td>mestii makan bukan sedap haha</td>\n",
       "      <td>1</td>\n",
       "      <td>mestii makan bukan tak_sedap haha</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Tapi milo dekat fast food restaurant tak sedap...</td>\n",
       "      <td>-1</td>\n",
       "      <td>milo fast food restaurant tak sedap</td>\n",
       "      <td>1</td>\n",
       "      <td>milo fast food restaurant tak tak_sedap</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Semua makanan bau tengik. Loya tekak dibuatnya...</td>\n",
       "      <td>-1</td>\n",
       "      <td>bau tengik loya tekak apa teruk peel demam pre...</td>\n",
       "      <td>-1</td>\n",
       "      <td>bau tengik loya tekak apa teruk peel demam pre...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                               tweet  senti  \\\n",
       "0  turn off betul kedai makan bancuh air tak seda...     -1   \n",
       "1  Mende tah aku makan tadi. Tak sedap. *sebab bo...     -1   \n",
       "2  @nikasyrvf Mestii, sini kedai makan bukan seda...     -1   \n",
       "3  Tapi milo dekat fast food restaurant tak sedap...     -1   \n",
       "4  Semua makanan bau tengik. Loya tekak dibuatnya...     -1   \n",
       "\n",
       "                                              tweets without_valenceshifter  \\\n",
       "0  turn off makan bancuh air tak sedap ini tak pa...                      1   \n",
       "1   mende entah makan tak sedap claim makan mengarut                      0   \n",
       "2                      mestii makan bukan sedap haha                      1   \n",
       "3                milo fast food restaurant tak sedap                      1   \n",
       "4  bau tengik loya tekak apa teruk peel demam pre...                     -1   \n",
       "\n",
       "                                            negation  \n",
       "0  turn off makan bancuh air tak tak_sedap ini ta...  \n",
       "1  mende entah makan tak tak_sedap claim makan me...  \n",
       "2                  mestii makan bukan tak_sedap haha  \n",
       "3            milo fast food restaurant tak tak_sedap  \n",
       "4  bau tengik loya tekak apa teruk peel demam pre...  "
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['negation']=np.array([negate(self=None,text=text) for text in df.tweets])\n",
    "df.head(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tweet</th>\n",
       "      <th>senti</th>\n",
       "      <th>tweets</th>\n",
       "      <th>without_valenceshifter</th>\n",
       "      <th>negation</th>\n",
       "      <th>with_valenceshifter</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>turn off betul kedai makan bancuh air tak seda...</td>\n",
       "      <td>-1</td>\n",
       "      <td>turn off makan bancuh air tak sedap ini tak pa...</td>\n",
       "      <td>1</td>\n",
       "      <td>turn off makan bancuh air tak tak_sedap ini ta...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Mende tah aku makan tadi. Tak sedap. *sebab bo...</td>\n",
       "      <td>-1</td>\n",
       "      <td>mende entah makan tak sedap claim makan mengarut</td>\n",
       "      <td>0</td>\n",
       "      <td>mende entah makan tak tak_sedap claim makan me...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>@nikasyrvf Mestii, sini kedai makan bukan seda...</td>\n",
       "      <td>-1</td>\n",
       "      <td>mestii makan bukan sedap haha</td>\n",
       "      <td>1</td>\n",
       "      <td>mestii makan bukan tak_sedap haha</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Tapi milo dekat fast food restaurant tak sedap...</td>\n",
       "      <td>-1</td>\n",
       "      <td>milo fast food restaurant tak sedap</td>\n",
       "      <td>1</td>\n",
       "      <td>milo fast food restaurant tak tak_sedap</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Semua makanan bau tengik. Loya tekak dibuatnya...</td>\n",
       "      <td>-1</td>\n",
       "      <td>bau tengik loya tekak apa teruk peel demam pre...</td>\n",
       "      <td>-1</td>\n",
       "      <td>bau tengik loya tekak apa teruk peel demam pre...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Aku rasa aku kena mula jaga pemakanan. Gastrik...</td>\n",
       "      <td>-1</td>\n",
       "      <td>kena jaga pemakanan gastrik ini teruk makan ke...</td>\n",
       "      <td>-1</td>\n",
       "      <td>kena jaga pemakanan gastrik ini teruk makan ke...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Apa dia letak sia kat makanan aku. Balik sakit...</td>\n",
       "      <td>-1</td>\n",
       "      <td>letak sia sakit kepala teruk ini</td>\n",
       "      <td>-1</td>\n",
       "      <td>letak tak_sia sakit kepala teruk ini</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>@KuaiMuhamad Tak jgk.. Lama gak x kena food po...</td>\n",
       "      <td>-1</td>\n",
       "      <td>tak juga gak tidak kena food poisoning just my...</td>\n",
       "      <td>-1</td>\n",
       "      <td>tak tak_juga gak tidak tak_kena food poisoning...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>LoL jual makanan tak sedap pastu mahal lak tu ...</td>\n",
       "      <td>-1</td>\n",
       "      <td>jual tak sedap mahal pula itu haiss</td>\n",
       "      <td>0</td>\n",
       "      <td>jual tak tak_sedap mahal pula itu haiss</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Makanan dia tak berapa sedap la for me. Dekat ...</td>\n",
       "      <td>-1</td>\n",
       "      <td>tak sedap lah untuk me surau disediakan</td>\n",
       "      <td>1</td>\n",
       "      <td>tak tak_sedap lah untuk me surau disediakan</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Makanan mahal2 ni aku memamg cop tak pernah se...</td>\n",
       "      <td>-1</td>\n",
       "      <td>mahal ini memamg cop tak sedap tak tahu mahal</td>\n",
       "      <td>0</td>\n",
       "      <td>mahal ini memamg cop tak tak_sedap tak tak_tah...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Lepas settle urusan kat sekolah, kitorang perg...</td>\n",
       "      <td>-1</td>\n",
       "      <td>settle urusan sekolah kitorang pergi lunch res...</td>\n",
       "      <td>-1</td>\n",
       "      <td>settle urusan sekolah kitorang pergi lunch res...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>@JohanRayyan Hahahaha! Adeihhh... Rasa mahal g...</td>\n",
       "      <td>-1</td>\n",
       "      <td>hahahaha adeihhh mahal gila milo fast food res...</td>\n",
       "      <td>-1</td>\n",
       "      <td>hahahaha adeihhh mahal gila milo fast food res...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Tropicana Avenue tu ada la restaurant yang mcm...</td>\n",
       "      <td>-1</td>\n",
       "      <td>tropicana avenue itu lah restaurant mahal siki...</td>\n",
       "      <td>-1</td>\n",
       "      <td>tropicana avenue itu lah restaurant mahal siki...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>\"kamu tahu tak kerusi di restaurant fast food ...</td>\n",
       "      <td>-1</td>\n",
       "      <td>tak kerusi restaurant fast food duduk tak sele...</td>\n",
       "      <td>0</td>\n",
       "      <td>tak tak_kerusi restaurant fast food duduk tak ...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Menyesal siak mkn makanan pedas skrg dh sakit ...</td>\n",
       "      <td>-1</td>\n",
       "      <td>menyesal siak mkn pedas skrg dah sakit perut a...</td>\n",
       "      <td>-1</td>\n",
       "      <td>menyesal siak mkn pedas skrg dah sakit perut a...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>Makan-makanan pedas bikin sakit perut. Dan mel...</td>\n",
       "      <td>-1</td>\n",
       "      <td>makan pedas bikin sakit perut melelahkan</td>\n",
       "      <td>-1</td>\n",
       "      <td>makan pedas bikin sakit perut melelahkan</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>b'Kyochon ini enak banget tapi juga mahal bang...</td>\n",
       "      <td>-1</td>\n",
       "      <td>b kyochon enak banget mahal banget wqwqwqwq</td>\n",
       "      <td>0</td>\n",
       "      <td>b kyochon enak banget mahal banget wqwqwqwq</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>b'@AsipMutakin Weh kfry tk sedap taknak pegi l...</td>\n",
       "      <td>-1</td>\n",
       "      <td>b weh kfry tak sedap tak nak pergi kyochon tak...</td>\n",
       "      <td>1</td>\n",
       "      <td>b weh kfry tak tak_sedap tak tak_nak pergi kyo...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>b'@luqmangg @nraleeya Tapi pedas kfry campur c...</td>\n",
       "      <td>-1</td>\n",
       "      <td>b pedas kfry campur cheese muak kyochon just n...</td>\n",
       "      <td>-1</td>\n",
       "      <td>b pedas kfry campur cheese muak kyochon just n...</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                tweet  senti  \\\n",
       "0   turn off betul kedai makan bancuh air tak seda...     -1   \n",
       "1   Mende tah aku makan tadi. Tak sedap. *sebab bo...     -1   \n",
       "2   @nikasyrvf Mestii, sini kedai makan bukan seda...     -1   \n",
       "3   Tapi milo dekat fast food restaurant tak sedap...     -1   \n",
       "4   Semua makanan bau tengik. Loya tekak dibuatnya...     -1   \n",
       "5   Aku rasa aku kena mula jaga pemakanan. Gastrik...     -1   \n",
       "6   Apa dia letak sia kat makanan aku. Balik sakit...     -1   \n",
       "7   @KuaiMuhamad Tak jgk.. Lama gak x kena food po...     -1   \n",
       "8   LoL jual makanan tak sedap pastu mahal lak tu ...     -1   \n",
       "9   Makanan dia tak berapa sedap la for me. Dekat ...     -1   \n",
       "10  Makanan mahal2 ni aku memamg cop tak pernah se...     -1   \n",
       "11  Lepas settle urusan kat sekolah, kitorang perg...     -1   \n",
       "12  @JohanRayyan Hahahaha! Adeihhh... Rasa mahal g...     -1   \n",
       "13  Tropicana Avenue tu ada la restaurant yang mcm...     -1   \n",
       "14  \"kamu tahu tak kerusi di restaurant fast food ...     -1   \n",
       "15  Menyesal siak mkn makanan pedas skrg dh sakit ...     -1   \n",
       "16  Makan-makanan pedas bikin sakit perut. Dan mel...     -1   \n",
       "17  b'Kyochon ini enak banget tapi juga mahal bang...     -1   \n",
       "18  b'@AsipMutakin Weh kfry tk sedap taknak pegi l...     -1   \n",
       "19  b'@luqmangg @nraleeya Tapi pedas kfry campur c...     -1   \n",
       "\n",
       "                                               tweets without_valenceshifter  \\\n",
       "0   turn off makan bancuh air tak sedap ini tak pa...                      1   \n",
       "1    mende entah makan tak sedap claim makan mengarut                      0   \n",
       "2                       mestii makan bukan sedap haha                      1   \n",
       "3                 milo fast food restaurant tak sedap                      1   \n",
       "4   bau tengik loya tekak apa teruk peel demam pre...                     -1   \n",
       "5   kena jaga pemakanan gastrik ini teruk makan ke...                     -1   \n",
       "6                    letak sia sakit kepala teruk ini                     -1   \n",
       "7   tak juga gak tidak kena food poisoning just my...                     -1   \n",
       "8                 jual tak sedap mahal pula itu haiss                      0   \n",
       "9             tak sedap lah untuk me surau disediakan                      1   \n",
       "10      mahal ini memamg cop tak sedap tak tahu mahal                      0   \n",
       "11  settle urusan sekolah kitorang pergi lunch res...                     -1   \n",
       "12  hahahaha adeihhh mahal gila milo fast food res...                     -1   \n",
       "13  tropicana avenue itu lah restaurant mahal siki...                     -1   \n",
       "14  tak kerusi restaurant fast food duduk tak sele...                      0   \n",
       "15  menyesal siak mkn pedas skrg dah sakit perut a...                     -1   \n",
       "16           makan pedas bikin sakit perut melelahkan                     -1   \n",
       "17        b kyochon enak banget mahal banget wqwqwqwq                      0   \n",
       "18  b weh kfry tak sedap tak nak pergi kyochon tak...                      1   \n",
       "19  b pedas kfry campur cheese muak kyochon just n...                     -1   \n",
       "\n",
       "                                             negation with_valenceshifter  \n",
       "0   turn off makan bancuh air tak tak_sedap ini ta...                  -1  \n",
       "1   mende entah makan tak tak_sedap claim makan me...                  -1  \n",
       "2                   mestii makan bukan tak_sedap haha                  -1  \n",
       "3             milo fast food restaurant tak tak_sedap                  -1  \n",
       "4   bau tengik loya tekak apa teruk peel demam pre...                  -1  \n",
       "5   kena jaga pemakanan gastrik ini teruk makan ke...                  -1  \n",
       "6                letak tak_sia sakit kepala teruk ini                  -1  \n",
       "7   tak tak_juga gak tidak tak_kena food poisoning...                  -1  \n",
       "8             jual tak tak_sedap mahal pula itu haiss                  -1  \n",
       "9         tak tak_sedap lah untuk me surau disediakan                  -1  \n",
       "10  mahal ini memamg cop tak tak_sedap tak tak_tah...                  -1  \n",
       "11  settle urusan sekolah kitorang pergi lunch res...                  -1  \n",
       "12  hahahaha adeihhh mahal gila milo fast food res...                  -1  \n",
       "13  tropicana avenue itu lah restaurant mahal siki...                  -1  \n",
       "14  tak tak_kerusi restaurant fast food duduk tak ...                  -1  \n",
       "15  menyesal siak mkn pedas skrg dah sakit perut a...                  -1  \n",
       "16           makan pedas bikin sakit perut melelahkan                  -1  \n",
       "17        b kyochon enak banget mahal banget wqwqwqwq                   0  \n",
       "18  b weh kfry tak tak_sedap tak tak_nak pergi kyo...                  -1  \n",
       "19  b pedas kfry campur cheese muak kyochon just n...                  -1  "
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['with_valenceshifter'] = df['negation'].apply(parse_senti)\n",
    "df.head(20)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "df.to_csv('done10.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 88,  59,  36],\n",
       "       [  7, 120,  10],\n",
       "       [  8,  66, 206]])"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "predicted=df.without_valenceshifter.astype(int)\n",
    "from sklearn.metrics import confusion_matrix\n",
    "cf =confusion_matrix(df.senti,predicted)\n",
    "cf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>Predicted</th>\n",
       "      <th>-1</th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>All</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Actual</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>-1</th>\n",
       "      <td>88</td>\n",
       "      <td>59</td>\n",
       "      <td>36</td>\n",
       "      <td>183</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>7</td>\n",
       "      <td>120</td>\n",
       "      <td>10</td>\n",
       "      <td>137</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>8</td>\n",
       "      <td>66</td>\n",
       "      <td>206</td>\n",
       "      <td>280</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>All</th>\n",
       "      <td>103</td>\n",
       "      <td>245</td>\n",
       "      <td>252</td>\n",
       "      <td>600</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "Predicted   -1    0    1  All\n",
       "Actual                       \n",
       "-1          88   59   36  183\n",
       "0            7  120   10  137\n",
       "1            8   66  206  280\n",
       "All        103  245  252  600"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "exp_series = pd.Series(df.senti)\n",
    "pred_series = pd.Series(predicted)\n",
    "pd.crosstab(exp_series, pred_series, rownames=['Actual'], colnames=['Predicted'],margins=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[113,  53,  17],\n",
       "       [  6, 121,  10],\n",
       "       [  8,  68, 204]])"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "predicted1=df.with_valenceshifter.astype(int)\n",
    "from sklearn.metrics import confusion_matrix\n",
    "cf =confusion_matrix(df.senti,predicted1)\n",
    "cf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>Predicted</th>\n",
       "      <th>-1</th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>All</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Actual</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>-1</th>\n",
       "      <td>113</td>\n",
       "      <td>53</td>\n",
       "      <td>17</td>\n",
       "      <td>183</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>6</td>\n",
       "      <td>121</td>\n",
       "      <td>10</td>\n",
       "      <td>137</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>8</td>\n",
       "      <td>68</td>\n",
       "      <td>204</td>\n",
       "      <td>280</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>All</th>\n",
       "      <td>127</td>\n",
       "      <td>242</td>\n",
       "      <td>231</td>\n",
       "      <td>600</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "Predicted   -1    0    1  All\n",
       "Actual                       \n",
       "-1         113   53   17  183\n",
       "0            6  121   10  137\n",
       "1            8   68  204  280\n",
       "All        127  242  231  600"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "exp_series = pd.Series(df.senti)\n",
    "pred_series = pd.Series(predicted1)\n",
    "pd.crosstab(exp_series, pred_series, rownames=['Actual'], colnames=['Predicted'],margins=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x1a24a1efd0>"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['senti'].value_counts().plot.bar(title='Distribution of sentiment polarity of our dataset')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tweet</th>\n",
       "      <th>tweets</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>turn off betul kedai makan bancuh air tak seda...</td>\n",
       "      <td>turn off makan bancuh air tak sedap ini tak pa...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Mende tah aku makan tadi. Tak sedap. *sebab bo...</td>\n",
       "      <td>mende entah makan tak sedap claim makan mengarut</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>@nikasyrvf Mestii, sini kedai makan bukan seda...</td>\n",
       "      <td>mestii makan bukan sedap haha</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Tapi milo dekat fast food restaurant tak sedap...</td>\n",
       "      <td>milo fast food restaurant tak sedap</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Semua makanan bau tengik. Loya tekak dibuatnya...</td>\n",
       "      <td>bau tengik loya tekak apa teruk peel demam pre...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Aku rasa aku kena mula jaga pemakanan. Gastrik...</td>\n",
       "      <td>kena jaga pemakanan gastrik ini teruk makan ke...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Apa dia letak sia kat makanan aku. Balik sakit...</td>\n",
       "      <td>letak sia sakit kepala teruk ini</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>@KuaiMuhamad Tak jgk.. Lama gak x kena food po...</td>\n",
       "      <td>tak juga gak tidak kena food poisoning just my...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>LoL jual makanan tak sedap pastu mahal lak tu ...</td>\n",
       "      <td>jual tak sedap mahal pula itu haiss</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Makanan dia tak berapa sedap la for me. Dekat ...</td>\n",
       "      <td>tak sedap lah untuk me surau disediakan</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Makanan mahal2 ni aku memamg cop tak pernah se...</td>\n",
       "      <td>mahal ini memamg cop tak sedap tak tahu mahal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Lepas settle urusan kat sekolah, kitorang perg...</td>\n",
       "      <td>settle urusan sekolah kitorang pergi lunch res...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>@JohanRayyan Hahahaha! Adeihhh... Rasa mahal g...</td>\n",
       "      <td>hahahaha adeihhh mahal gila milo fast food res...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Tropicana Avenue tu ada la restaurant yang mcm...</td>\n",
       "      <td>tropicana avenue itu lah restaurant mahal siki...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>\"kamu tahu tak kerusi di restaurant fast food ...</td>\n",
       "      <td>tak kerusi restaurant fast food duduk tak sele...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Menyesal siak mkn makanan pedas skrg dh sakit ...</td>\n",
       "      <td>menyesal siak mkn pedas skrg dah sakit perut a...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>Makan-makanan pedas bikin sakit perut. Dan mel...</td>\n",
       "      <td>makan pedas bikin sakit perut melelahkan</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>b'Kyochon ini enak banget tapi juga mahal bang...</td>\n",
       "      <td>b kyochon enak banget mahal banget wqwqwqwq</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>b'@AsipMutakin Weh kfry tk sedap taknak pegi l...</td>\n",
       "      <td>b weh kfry tak sedap tak nak pergi kyochon tak...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>b'@luqmangg @nraleeya Tapi pedas kfry campur c...</td>\n",
       "      <td>b pedas kfry campur cheese muak kyochon just n...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>i must say this restoran makanan dekat penang ...</td>\n",
       "      <td>saya must say this restoran penang mostly koto...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>nak heran apa. Klcc punya level kebersihan lev...</td>\n",
       "      <td>hairan klcc level kebersihan level makan tepi ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>Aku ni memang geli sikit tempat_ kotor. Ka...</td>\n",
       "      <td>ini geli sikit kotor makan tak pergi ntah ru</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>kalau boleh nk bagi tips cari partner hidup : ...</td>\n",
       "      <td>tips cari partner hidup bersihkan sinki kenapa...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>Geli, Kotor, Bahaya! Sebelum Nak Suap Anak Den...</td>\n",
       "      <td>geli kotor bahaya suap anak sudu makan pastika...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>Kalau aku sampai 2 kali pegi kedai dia mintak ...</td>\n",
       "      <td>kali pergi minta sudu garfu jela lah mengamuk ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>Aku rasa telor aku goreng sendiri lagi sedap d...</td>\n",
       "      <td>telor goreng sedap masak mereka tak kacau seka...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>turn off betul kedai makan bancuh air tak seda...</td>\n",
       "      <td>turn off makan bancuh air tak sedap ini tak pa...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>@Benjy_Danial Hahahaha mcm sedap tp xnak mamak...</td>\n",
       "      <td>danial hahahaha sedap tapi xnak mamak</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>b'Burger ghost pepper kfc tu aku ingatkan peda...</td>\n",
       "      <td>b burger ghost pepper kfc itu ingatkan pedas g...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>570</th>\n",
       "      <td>Murah gila ada banyak hidangan pulak tu peeeeee</td>\n",
       "      <td>murah gila hidangan pula itu peeeeee</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>571</th>\n",
       "      <td>terliur saye tengok</td>\n",
       "      <td>terliur saye tengok</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>572</th>\n",
       "      <td>meleleh air liur aku</td>\n",
       "      <td>meleleh air liur</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>573</th>\n",
       "      <td>lagi kenyang aku mkn kedai mamak_Ù÷â</td>\n",
       "      <td>kenyang mkn mamak</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>574</th>\n",
       "      <td>dia punya sup labu skit nak mmpos dh lah mahal...</td>\n",
       "      <td>sup labu skit mampus dah mahal aku suruh bpk a...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>575</th>\n",
       "      <td>mahal</td>\n",
       "      <td>mahal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>576</th>\n",
       "      <td>mmg suka makan mulut senget ehh... Hehe...terl...</td>\n",
       "      <td>suka makan mulut senget hehe terliur</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>577</th>\n",
       "      <td>bapak mahal</td>\n",
       "      <td>mahal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>578</th>\n",
       "      <td>betul2 rabak tgok harga.. aishh.. 69rggt .. la...</td>\n",
       "      <td>rabak tgok harga aishh rggt lau kua kepada bln...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>579</th>\n",
       "      <td>rabakkk duitt matt</td>\n",
       "      <td>rabakkk duitt matt</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>580</th>\n",
       "      <td>patut tokey kaya..jual mahal mampus</td>\n",
       "      <td>tokey kaya jual mahal mampus</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>581</th>\n",
       "      <td>patut lah orang tak de harganya terlalu nak rabak</td>\n",
       "      <td>tak ada harganya rabak</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>582</th>\n",
       "      <td>bro, bile nak buat review ayam bakar telangkup...</td>\n",
       "      <td>abang bila review ayam bakar telangkup port di...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>583</th>\n",
       "      <td>brahim pendek baling dadu .skali ngap..uuuhhhh...</td>\n",
       "      <td>brahim pendek baling dadu sekali ngap uuuhhhhh...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>584</th>\n",
       "      <td>Aku pakai hadalabo bukan every month aku beli ...</td>\n",
       "      <td>pakai hadalabo bukan every month beli untuk pe...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>585</th>\n",
       "      <td>@azmeersadali @faizolazhar Camni azmeer. Klu m...</td>\n",
       "      <td>macam ini azmeer kalau muka rabak tapi duit pa...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>586</th>\n",
       "      <td>My skin getting better!! Alhamdulillah fuhh.. ...</td>\n",
       "      <td>my skin getting better alhamdulillah fuhh itul...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>587</th>\n",
       "      <td>Silap2 rabak duit malam ni</td>\n",
       "      <td>silap rabak duit ini</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>588</th>\n",
       "      <td>lol apa lj aku stakat tgk surrounding then kau...</td>\n",
       "      <td>lj stakat tengok surrounding then cakap amp ta...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>589</th>\n",
       "      <td>We donno their situation. Aku prnah tgk dgn ma...</td>\n",
       "      <td>we donno their situation prnah tengok mata kep...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>590</th>\n",
       "      <td>@_Jaaa11 @nrftnn__ @Syhrasd Bukan selalulah se...</td>\n",
       "      <td>jaaa bukan selalulah rabak duit</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>591</th>\n",
       "      <td>\"Nak tunggu kau buat? Campak duit depan kau ba...</td>\n",
       "      <td>tunggu campak duit jln itu sentence just sot r...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>592</th>\n",
       "      <td>Beli seluar tp bila pakai dekat rumah eh tak m...</td>\n",
       "      <td>beli seluar tapi pakai rumah eh tak muat gue s...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>593</th>\n",
       "      <td>Rabak duit _ÙÕü_ÙÕü_ÙÕü</td>\n",
       "      <td>rabak duit</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>594</th>\n",
       "      <td>Sumpah menyesal betul keluar, rabak sia duit aku</td>\n",
       "      <td>sumpah menyesal rabak sia duit</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>595</th>\n",
       "      <td>Parak rabak duit bulan ni</td>\n",
       "      <td>parak rabak duit ini</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>596</th>\n",
       "      <td>walao ni orang every week ajak pi jalan mampus...</td>\n",
       "      <td>walao ini every week ajak pi jalan mampus raba...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>597</th>\n",
       "      <td>settle bayar hutang.. skrg duit rabak.. haha</td>\n",
       "      <td>settle bayar hutang skrg duit rabak haha</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>598</th>\n",
       "      <td>sumpah masin weh _Ù÷__Ù÷__Ù÷_ haihhhh failnya ...</td>\n",
       "      <td>sumpah masin weh haihhhh failnya makan sobs sobs</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>599</th>\n",
       "      <td>RT @hilaamohamed: lepas ni malas masak dah la....</td>\n",
       "      <td>rt ini malas masak lah masak sikit kena aduan ...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>600 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                 tweet  \\\n",
       "0    turn off betul kedai makan bancuh air tak seda...   \n",
       "1    Mende tah aku makan tadi. Tak sedap. *sebab bo...   \n",
       "2    @nikasyrvf Mestii, sini kedai makan bukan seda...   \n",
       "3    Tapi milo dekat fast food restaurant tak sedap...   \n",
       "4    Semua makanan bau tengik. Loya tekak dibuatnya...   \n",
       "5    Aku rasa aku kena mula jaga pemakanan. Gastrik...   \n",
       "6    Apa dia letak sia kat makanan aku. Balik sakit...   \n",
       "7    @KuaiMuhamad Tak jgk.. Lama gak x kena food po...   \n",
       "8    LoL jual makanan tak sedap pastu mahal lak tu ...   \n",
       "9    Makanan dia tak berapa sedap la for me. Dekat ...   \n",
       "10   Makanan mahal2 ni aku memamg cop tak pernah se...   \n",
       "11   Lepas settle urusan kat sekolah, kitorang perg...   \n",
       "12   @JohanRayyan Hahahaha! Adeihhh... Rasa mahal g...   \n",
       "13   Tropicana Avenue tu ada la restaurant yang mcm...   \n",
       "14   \"kamu tahu tak kerusi di restaurant fast food ...   \n",
       "15   Menyesal siak mkn makanan pedas skrg dh sakit ...   \n",
       "16   Makan-makanan pedas bikin sakit perut. Dan mel...   \n",
       "17   b'Kyochon ini enak banget tapi juga mahal bang...   \n",
       "18   b'@AsipMutakin Weh kfry tk sedap taknak pegi l...   \n",
       "19   b'@luqmangg @nraleeya Tapi pedas kfry campur c...   \n",
       "20   i must say this restoran makanan dekat penang ...   \n",
       "21   nak heran apa. Klcc punya level kebersihan lev...   \n",
       "22   Aku ni memang geli sikit tempat_ kotor. Ka...   \n",
       "23   kalau boleh nk bagi tips cari partner hidup : ...   \n",
       "24   Geli, Kotor, Bahaya! Sebelum Nak Suap Anak Den...   \n",
       "25   Kalau aku sampai 2 kali pegi kedai dia mintak ...   \n",
       "26   Aku rasa telor aku goreng sendiri lagi sedap d...   \n",
       "27   turn off betul kedai makan bancuh air tak seda...   \n",
       "28   @Benjy_Danial Hahahaha mcm sedap tp xnak mamak...   \n",
       "29   b'Burger ghost pepper kfc tu aku ingatkan peda...   \n",
       "..                                                 ...   \n",
       "570    Murah gila ada banyak hidangan pulak tu peeeeee   \n",
       "571                                terliur saye tengok   \n",
       "572                               meleleh air liur aku   \n",
       "573               lagi kenyang aku mkn kedai mamak_Ù÷â   \n",
       "574  dia punya sup labu skit nak mmpos dh lah mahal...   \n",
       "575                                              mahal   \n",
       "576  mmg suka makan mulut senget ehh... Hehe...terl...   \n",
       "577                                        bapak mahal   \n",
       "578  betul2 rabak tgok harga.. aishh.. 69rggt .. la...   \n",
       "579                                 rabakkk duitt matt   \n",
       "580                patut tokey kaya..jual mahal mampus   \n",
       "581  patut lah orang tak de harganya terlalu nak rabak   \n",
       "582  bro, bile nak buat review ayam bakar telangkup...   \n",
       "583  brahim pendek baling dadu .skali ngap..uuuhhhh...   \n",
       "584  Aku pakai hadalabo bukan every month aku beli ...   \n",
       "585  @azmeersadali @faizolazhar Camni azmeer. Klu m...   \n",
       "586  My skin getting better!! Alhamdulillah fuhh.. ...   \n",
       "587                         Silap2 rabak duit malam ni   \n",
       "588  lol apa lj aku stakat tgk surrounding then kau...   \n",
       "589  We donno their situation. Aku prnah tgk dgn ma...   \n",
       "590  @_Jaaa11 @nrftnn__ @Syhrasd Bukan selalulah se...   \n",
       "591  \"Nak tunggu kau buat? Campak duit depan kau ba...   \n",
       "592  Beli seluar tp bila pakai dekat rumah eh tak m...   \n",
       "593                            Rabak duit _ÙÕü_ÙÕü_ÙÕü   \n",
       "594   Sumpah menyesal betul keluar, rabak sia duit aku   \n",
       "595                          Parak rabak duit bulan ni   \n",
       "596  walao ni orang every week ajak pi jalan mampus...   \n",
       "597       settle bayar hutang.. skrg duit rabak.. haha   \n",
       "598  sumpah masin weh _Ù÷__Ù÷__Ù÷_ haihhhh failnya ...   \n",
       "599  RT @hilaamohamed: lepas ni malas masak dah la....   \n",
       "\n",
       "                                                tweets  \n",
       "0    turn off makan bancuh air tak sedap ini tak pa...  \n",
       "1     mende entah makan tak sedap claim makan mengarut  \n",
       "2                        mestii makan bukan sedap haha  \n",
       "3                  milo fast food restaurant tak sedap  \n",
       "4    bau tengik loya tekak apa teruk peel demam pre...  \n",
       "5    kena jaga pemakanan gastrik ini teruk makan ke...  \n",
       "6                     letak sia sakit kepala teruk ini  \n",
       "7    tak juga gak tidak kena food poisoning just my...  \n",
       "8                  jual tak sedap mahal pula itu haiss  \n",
       "9              tak sedap lah untuk me surau disediakan  \n",
       "10       mahal ini memamg cop tak sedap tak tahu mahal  \n",
       "11   settle urusan sekolah kitorang pergi lunch res...  \n",
       "12   hahahaha adeihhh mahal gila milo fast food res...  \n",
       "13   tropicana avenue itu lah restaurant mahal siki...  \n",
       "14   tak kerusi restaurant fast food duduk tak sele...  \n",
       "15   menyesal siak mkn pedas skrg dah sakit perut a...  \n",
       "16            makan pedas bikin sakit perut melelahkan  \n",
       "17         b kyochon enak banget mahal banget wqwqwqwq  \n",
       "18   b weh kfry tak sedap tak nak pergi kyochon tak...  \n",
       "19   b pedas kfry campur cheese muak kyochon just n...  \n",
       "20   saya must say this restoran penang mostly koto...  \n",
       "21   hairan klcc level kebersihan level makan tepi ...  \n",
       "22        ini geli sikit kotor makan tak pergi ntah ru  \n",
       "23   tips cari partner hidup bersihkan sinki kenapa...  \n",
       "24   geli kotor bahaya suap anak sudu makan pastika...  \n",
       "25   kali pergi minta sudu garfu jela lah mengamuk ...  \n",
       "26   telor goreng sedap masak mereka tak kacau seka...  \n",
       "27   turn off makan bancuh air tak sedap ini tak pa...  \n",
       "28               danial hahahaha sedap tapi xnak mamak  \n",
       "29   b burger ghost pepper kfc itu ingatkan pedas g...  \n",
       "..                                                 ...  \n",
       "570               murah gila hidangan pula itu peeeeee  \n",
       "571                                terliur saye tengok  \n",
       "572                                   meleleh air liur  \n",
       "573                                  kenyang mkn mamak  \n",
       "574  sup labu skit mampus dah mahal aku suruh bpk a...  \n",
       "575                                              mahal  \n",
       "576               suka makan mulut senget hehe terliur  \n",
       "577                                              mahal  \n",
       "578  rabak tgok harga aishh rggt lau kua kepada bln...  \n",
       "579                                 rabakkk duitt matt  \n",
       "580                       tokey kaya jual mahal mampus  \n",
       "581                             tak ada harganya rabak  \n",
       "582  abang bila review ayam bakar telangkup port di...  \n",
       "583  brahim pendek baling dadu sekali ngap uuuhhhhh...  \n",
       "584  pakai hadalabo bukan every month beli untuk pe...  \n",
       "585  macam ini azmeer kalau muka rabak tapi duit pa...  \n",
       "586  my skin getting better alhamdulillah fuhh itul...  \n",
       "587                               silap rabak duit ini  \n",
       "588  lj stakat tengok surrounding then cakap amp ta...  \n",
       "589  we donno their situation prnah tengok mata kep...  \n",
       "590                    jaaa bukan selalulah rabak duit  \n",
       "591  tunggu campak duit jln itu sentence just sot r...  \n",
       "592  beli seluar tapi pakai rumah eh tak muat gue s...  \n",
       "593                                         rabak duit  \n",
       "594                     sumpah menyesal rabak sia duit  \n",
       "595                               parak rabak duit ini  \n",
       "596  walao ini every week ajak pi jalan mampus raba...  \n",
       "597           settle bayar hutang skrg duit rabak haha  \n",
       "598   sumpah masin weh haihhhh failnya makan sobs sobs  \n",
       "599  rt ini malas masak lah masak sikit kena aduan ...  \n",
       "\n",
       "[600 rows x 2 columns]"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1=df[['tweet','tweets']]\n",
    "df1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# df2=df[['tweet','negation']]\n",
    "df2.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tweet</th>\n",
       "      <th>negation</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>turn off betul kedai makan bancuh air tak seda...</td>\n",
       "      <td>turn off makan bancuh air tak tak_sedap ini ta...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Mende tah aku makan tadi. Tak sedap. *sebab bo...</td>\n",
       "      <td>mende entah makan tak tak_sedap claim makan me...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>@nikasyrvf Mestii, sini kedai makan bukan seda...</td>\n",
       "      <td>mestii makan bukan tak_sedap haha</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Tapi milo dekat fast food restaurant tak sedap...</td>\n",
       "      <td>milo fast food restaurant tak tak_sedap</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Semua makanan bau tengik. Loya tekak dibuatnya...</td>\n",
       "      <td>bau tengik loya tekak apa teruk peel demam pre...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                               tweet  \\\n",
       "0  turn off betul kedai makan bancuh air tak seda...   \n",
       "1  Mende tah aku makan tadi. Tak sedap. *sebab bo...   \n",
       "2  @nikasyrvf Mestii, sini kedai makan bukan seda...   \n",
       "3  Tapi milo dekat fast food restaurant tak sedap...   \n",
       "4  Semua makanan bau tengik. Loya tekak dibuatnya...   \n",
       "\n",
       "                                            negation  \n",
       "0  turn off makan bancuh air tak tak_sedap ini ta...  \n",
       "1  mende entah makan tak tak_sedap claim makan me...  \n",
       "2                  mestii makan bukan tak_sedap haha  \n",
       "3            milo fast food restaurant tak tak_sedap  \n",
       "4  bau tengik loya tekak apa teruk peel demam pre...  "
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df3=df[['tweet','negation']]\n",
    "df3.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    turn off betul kedai makan bancuh air tak seda...\n",
       "1    Mende tah aku makan tadi. Tak sedap. *sebab bo...\n",
       "2    @nikasyrvf Mestii, sini kedai makan bukan seda...\n",
       "3    Tapi milo dekat fast food restaurant tak sedap...\n",
       "4    Semua makanan bau tengik. Loya tekak dibuatnya...\n",
       "5    Aku rasa aku kena mula jaga pemakanan. Gastrik...\n",
       "6    Apa dia letak sia kat makanan aku. Balik sakit...\n",
       "7    @KuaiMuhamad Tak jgk.. Lama gak x kena food po...\n",
       "Name: tweet, dtype: object"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['tweet'].head(8)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
